<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~
  -->

<div fxLayout="row" fxFlex="100">
    <div fxFlex fxLayoutAlign="start center" fxLayout="row">
        <button
            color="accent"
            mat-button
            data-cy="connect-add-static-property"
            matTooltip="Add a static value to event"
            [matMenuTriggerFor]="staticValueMenu"
        >
            <mat-icon>add</mat-icon>
            <span>&nbsp;Add static value</span>
        </button>
        <mat-menu #staticValueMenu="matMenu">
            <div
                (click)="$event.stopPropagation()"
                (keydown)="$event.stopPropagation()"
            >
                <div fxLayout="column" class="m-5">
                    <div fxLayout="column">
                        <h5>Field name</h5>
                        <mat-form-field
                            color="accent"
                            class="form-field-small"
                            appearance="outline"
                        >
                            <input
                                matInput
                                [(ngModel)]="staticValueKey"
                                data-cy="connect-add-field-name"
                            />
                        </mat-form-field>
                    </div>
                    <div fxLayoutAlign="end center">
                        <button
                            mat-button
                            mat-raised-button
                            color="accent"
                            (click)="addStaticValueProperty()"
                            data-cy="connect-add-field-name-button"
                        >
                            Add
                        </button>
                    </div>
                </div>
            </div>
        </mat-menu>
        <button
            color="accent"
            mat-button
            data-cy="connect-schema-add-timestamp-btn"
            matTooltip="Add timestamp to event schema"
            [disabled]="timestampPresent"
            (click)="addTimestampProperty()"
        >
            <mat-icon>access_time</mat-icon>
            <span>&nbsp;Add timestamp</span>
        </button>
    </div>
    <div fxLayout="row" fxLayoutAlign="end center">
        <button
            color="accent"
            mat-icon-button
            matTooltip="Refresh Schema"
            data-cy="refresh-schema"
            (click)="guessSchema()"
        >
            <mat-icon>refresh</mat-icon>
        </button>

        <button
            style="padding-right: 0"
            color="accent"
            mat-icon-button
            matTooltip="Remove selected Properties"
            [disabled]="countSelected === 0"
            (click)="removeSelectedProperties()"
            data-cy="connect-schema-delete-properties-btn"
        >
            <mat-icon>delete</mat-icon>
        </button>
    </div>
</div>
